<!--
 * @Author: wangming
 * @Date: 2021-04-15 16:04:13
 * @LastEditors: wangming
 * @LastEditTime: 2022-08-02 14:48:44
 * @Description: file content
-->
<template>
  <div>
    <el-form-item
      label="链接内容"
      prop="__config.content"
      :rules="[
        {
          required: true,
          message: '链接内容不能为空',
          trigger: 'blur',
        },
      ]"
    >
      <el-input
        v-model="value.__config.content"
        size="small"
        placeholder="请输入"
      ></el-input>
    </el-form-item>
    <el-form-item
      label="链接地址"
      prop="__config.href"
      :rules="[
        {
          required: true,
          message: '链接地址不能为空',
          trigger: 'blur',
        },
        { pattern: URL_REG, message: '请输入有效地址', trigger: 'blur' },
      ]"
    >
      <el-input
        v-model="value.__config.href"
        size="small"
        placeholder="请输入"
      ></el-input>
    </el-form-item>
    <el-form-item label="打开方式">
      <el-radio-group v-model="value.__config.target">
        <el-radio label="_blank">新窗口打开</el-radio>
        <el-radio label="_self">当前页面打开</el-radio>
      </el-radio-group>
    </el-form-item>
    <el-form-item label="是否有下划线" class="tr">
      <el-switch
        :disabled="value.__config.disabled"
        v-model="value.__config.underline"
      ></el-switch>
    </el-form-item>
    <el-form-item label="是否禁用配置" class="tr">
      <el-switch
        v-model="value.__config.disabled"
        @change="disabledConfig"
      ></el-switch>
    </el-form-item>
  </div>
</template>
<script>
import basicmixins from "./basicmixins";
import { URL_REG } from "@/utils/reg";
export default {
  mixins: [basicmixins],
  data() {
    return { URL_REG };
  },
  methods: {
    disabledConfig(event) {
      if (event) {
        this.value.__config.underline = false;
      }
    },
  },
};
</script>

<style lang="scss" scoped></style>
